import tkinter as tk

root = tk.Tk()

root.geometry('500x300')
text = tk.Text(root)
text.pack()

btn = tk.Button(root, text='获取内容')
btn.pack()


def get_text():
    # index index
    # 几行.几列 几行.几列
    print([text.get('1.0', tk.END)])


btn.config(command=get_text)
root.mainloop()
